#include "SciEditor.h"

SciEditor::SciEditor(HWND parent,int x,int y,int width,int height)
{
    _hwnd = ::CreateWindow(
        TEXT("Scintilla"),
        TEXT("Source"),
        WS_CHILD | WS_VSCROLL | WS_HSCROLL | WS_CLIPCHILDREN
        |WS_VISIBLE,
        x, y,
        width,height,
        parent,
        0,
        hInst,
        0);
}

LRESULT SciEditor::sendMessage(UINT Msg, WPARAM wParam, LPARAM lParam)
{
    return ::SendMessage(_hwnd, Msg, wParam, lParam);
}
void SciEditor::getRange(int start, int end, TCHAR* text) {
    TEXTRANGE tr;
    tr.chrg.cpMin = start;
    tr.chrg.cpMax = end;
    tr.lpstrText = text;
    SendMessage(_hwnd, EM_GETTEXTRANGE, 0, reinterpret_cast<LPARAM>(&tr));
}
